Page 92 - 2629_Devagiri_C-6
P. 92

OPENING AN EXISTING PROGRAM


                  You can open an existing Python program to make changes or run it again. To open an existing
                  Python program, follow the given steps:


                      1    Click on the File menu.                                        4    Select the program file.



                    2    Click on the Open option.
                        The Open dialog box will
                                      appear.
                                                                     3    Navigate to the
                                                                     location where you
                                                                    have saved your file.  5    Click on the Open button.


                  The selected Python program is now open in the editor, ready for you to modify or execute.















                         INPUT AND OUTPUT


                  Python provides built-in functions to interact with users and handle input and output operations.

                  THE INPUT( ) FUNCTION

                  The input() function is used to take input from the user. It reads a line of text entered by the user,
                  which is then returned as a string.
                  Syntax of input() function:


                  input(<prompt>)
                  Here, the prompt is the string or message you want to display on the screen.
                  For example:

                  name = input("Enter your name: ")

                  >>> Enter your name: Ankit
                  The text ‘Ankit’ entered by the user will be stored in the variable name.


                  THE PRINT( ) FUNCTION
                  The print() function is used to display output on the screen in Python. It takes the specified text,
                  variable or value and prints it in the Python shell or terminal.




                   90
                        Premium Edition-VI



     5
   87   88   89   90   91   92   93   94   95   96   97